﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace gvPoco.ChartOptions
{
    public class Animation
    {
        /// <summary>
        /// The duration of the animation, in milliseconds.
        /// </summary>
        public int duration { get; private set; }

        /// <summary>
        /// The easing function applied to the animation. The following options are available:
        /// - 'linear' - Constant speed.
        /// - 'in' - Ease in - Start slow and speed up.
        /// - 'out' - Ease out - Start fast and slow down.
        /// - 'inAndOut' - Ease in and out - Start slow, speed up, then slow down.
        /// </summary>
        public string easing { get; private set; }

        public Animation()
        {

        }

        /// <summary>
        /// Set the easing function applied to the animation. The following options are available:
        /// - 'linear' - Constant speed.
        /// - 'in' - Ease in - Start slow and speed up.
        /// - 'out' - Ease out - Start fast and slow down.
        /// - 'inAndOut' - Ease in and out - Start slow, speed up, then slow down.
        /// </summary>
        /// <param name="durationMilli">The duration of the animation, in milliseconds.</param>
        /// <param name="easingValue">The option for the easing function</param>
        public void SetEasingAnimation(int durationMilli, string easingValue)
        {
            string[] valids = { "linear", "in", "out", "inAndOut" };
            if (valids.Contains(easingValue))
            {
                duration = durationMilli;
                easing = easingValue;
            }
            // else throw some error
        }
    }
}